package com.chenyongjing.design.pattern.observer.blog;

/**
 * @Author chen
 * @Date 2022/12/5 21:37
 */
public class Test {
    public static void main(String[] args) {
        Blog blog = Blog.getInstance();
        User xiaoming = new User("小明");
        User xiaoli = new User("小李");

        blog.addObserver(xiaoming);
        blog.addObserver(xiaoli);

        Message msg = new Message();
        msg.setUserName("小张");
        msg.setContent("你们有空吗？");

        blog.publish(msg);
    }
}
